<h2>Danh mục sản phẩm</h2>
	<?php echo$form->create('Search', array('url' => '/categories/dataSearch'))?>
	<p class="search-box">
		<label class="hidden" for="post-search-input">Search categories:</label> 	
		<?php echo$form->input('Search.name', array('class' => 'search-input', 'id' => 'post-search-input', 'label' => '', 'div' => false))?>
		<?php echo$form->submit('Search Post', array('class' => 'button', 'div' => false))?>
	</p>

	<input name="mode" value="list" type="hidden">
	<div class="tablenav">	
		<div class="alignleft actions">
			<?php echo$form->input('Search.name', array('id' => 'category', 'class' => 'postform','empty' => 'Tất cả ','label' => 'Tên category:', 'div' => false))?> 
			<?php echo$form->input('Search.level', array('id' => 'category', 'class' => 'postform', 'options' => $levels, 'empty' => 'Tất cả ','label' => ' Mức:', 'div' => false))?>
			<?php echo$form->submit('Apply', array('id' => 'post-query-submit', 'class' => 'button-secondary', 'div' => false))?>
		</div>
		
		<div class="tablenav-pages">
			<span class="displaying-num"><?php echo $paginator->counter(array( 'format' => 'Display %start%-%end% of %count%')); ?></span>
			<?php
				echo $paginator->options(array('url' => $this->passedArgs));
				echo $paginator->prev('« ', array('class' => 'prev page-numbers'));
				echo ' '.$paginator->numbers(array('class' => 'page-numbers', 'separator' => ' ', 'modulus' => '5')).' ';
				echo $paginator->next(' »', array('class' => 'next page-numbers'));
			?>
		</div>
		<!-- 
		<div class="view-switch">
			<a href="#"><?php echo$html->image('wp-admin/blank.gif', array('id' => 'view-switch-list', 'class' => 'current', 'title' => 'List View', 'alt' => 'List View', 'height' => '20', 'width' => '20'))?> </a> 
			<a href="#"><?php echo$html->image('wp-admin/blank.gif', array('id' => 'view-switch-excerpt', 'class' => 'current', 'title' => 'Excerpt View', 'alt' => 'Excerpt View', 'height' => '20', 'width' => '20'))?></a>
		</div>
		 -->
		<div class="clear"></div>
	</div>
	
	<div class="clear"></div>
	<?php echo$form->end()?>
	
	<?php echo$form->create('Delete', array('url' => '/categories/multiDelete'))?>
	<table class="widefat post fixed" cellspacing="0">
		<thead>
			<tr>
				<th scope="col" id="cb" class="manage-column column-cb check-column" style="width:15px"><input type="checkbox"></th>
				<th scope="col" id="author" class="manage-column column-author" style="width:300px"><?php echo$paginator->sort('Tên category', 'name')?></th>
				<th scope="col" id="categories" class="manage-column column-categories" style="width:150px"><?php echo$paginator->sort('Category cha', 'parent_id')?></th>
				<th scope="col" id="categories" class="manage-column column-categories" style="width:30px"><?php echo$paginator->sort('Mức', 'level')?></th>
				<th scope="col" id="tags" class="manage-column column-tags" style="width:50-x"><?php echo$paginator->sort('Ngày tạo', 'created_date')?></th>
			</tr>
		</thead>
	
		<tfoot>
			<tr>
				<th scope="col" id="cb" class="manage-column column-cb check-column" ><input type="checkbox"></th>
				<th scope="col" id="author" class="manage-column column-author" ><?php echo$paginator->sort('Tên category', 'name')?></th>
				<th scope="col" id="" class="manage-column column-categories" ><?php echo$paginator->sort('Category cha', 'parent_id')?></th>
				<th scope="col" id="" class="manage-column column-categories" ><?php echo$paginator->sort('Mức', 'level')?></th>
				<th scope="col" id="tags" class="manage-column column-tags" style=""><?php echo$paginator->sort('Ngày tạo', 'created_date')?></th>
			</tr>
		</tfoot>
	
		<tbody>
			<?php 
			foreach ($categories as $cat)
			{
			?>
			<tr id="post-<?php echo$cat['Category']['id']?>" class="alternate author-other status-publish iedit" valign="top">
				<th scope="row" class="check-column" style="width:3%">
					<?php echo$form->input("record.".$cat['Category']['id'], array('label' => '','type' => 'checkbox'))?>
				</th>
				<td class="post-title column-title">
					<strong><a class="row-title" href="#" title="Edit &quot;<?php echo$cat['Category']['name']?>"><?php echo$cat['Category']['name']?></a></strong>
					<div class="row-actions">
						<span class="view"><a href="<?php echo$html->url('/categories/add')?>" title="Add" rel="permalink">Add</a> | </span>
						<span class="edit"><a href="<?php echo$html->url('/categories/edit/'.$cat['Category']['id'])?>" title="Edit">Edit</a> | </span>
						<span class="delete"><a class="submitdelete" title="Delete" href="<?php echo$html->url('/categories/delete/'.$cat['Category']['id'])?>" onclick="if ( confirm('You are about to delete \'<?php echo$cat['Category']['name']?>\'\n \'Cancel\' to stop, \'OK\' to delete.') ) { return true;}return false;">Delete</a></span>
					</div>
				</td>
				<td class="post-title column-title">
					<strong><?php echo$cat['Parentcat']['name']?></strong>
				</td>
				<td class="post-title column-title">
					<strong><?php echo$cat['Category']['level']?></strong>
				</td>
				<td class="date column-date">
					<abbr title="<?php echo$time->format('d/m/y h:m:s', $cat['Category']['created'])?>"><?php echo$time->format('d/m/y', $cat['Category']['created'])?></abbr>
				</td>
			</tr>
			<?php 
			}
			?>
			
		</tbody>
	</table>
	
	<!-- bof tablenav -->
	<div class="tablenav">
		<div class="tablenav-pages">
			<span class="displaying-num"><?php echo $paginator->counter(array( 'format' => 'Display %start%-%end% of %count%')); ?></span>
			<?php
				echo $paginator->prev('«', array('class' => 'prev page-numbers'));
				echo ' '.$paginator->numbers(array('class' => 'page-numbers', 'separator' => ' ', 'modulus' => '5')).' ';
				echo $paginator->next('»', array('class' => 'next page-numbers'));
			?>
		</div>
		<div class="alignleft actions">
			<?php echo$form->submit('Delete', array('name' => 'doaction2', 'class' => 'button-secondary action', 'div' => false))?> 
			<br class="clear">
		</div>
		<br class="clear">
	</div>
	<!-- eof tablenav -->
	<?php echo$form->end()?>

<div id="ajax-response"></div>
<br class="clear">